Skip to content

Remove sensitive data from debug logs#50

Open
Catafal wants to merge 1 commit intofarzaa:mainfrom
Catafal:fix/remove-sensitive-logging
Open

Remove sensitive data from debug logs#50
Catafal wants to merge 1 commit intofarzaa:mainfrom
Catafal:fix/remove-sensitive-logging

Conversation

@Catafal
Copy link
Copy Markdown

@Catafal Catafal commented Apr 10, 2026

Feature

Remove PII and security-sensitive values from debug print statements (resolves #44)

Problem

Seven print() calls were writing sensitive runtime data to the system log, visible in Console.app to anyone with local machine access:

Location What was leaked
AssemblyAIStreamingTranscriptionProvider.swift:44 First 20 chars of a live AssemblyAI bearer token
CompanionManager.swift:522 Full verbatim user speech transcript (every word spoken)
CompanionManager.swift:679 Exact screen coordinates + human-readable UI element label
CompanionManager.swift:681 UI element label (no-coordinate path)
CompanionManager.swift:1020 Element label + Claude's exact spoken response (onboarding)
ElementLocationDetector.swift:113–116 Raw and scaled pixel coordinates of pointed-at element
ElementLocationDetector.swift:257 Raw Computer Use coordinate of target element

Changes

AssemblyAIStreamingTranscriptionProvider.swift

  • "fetched temporary token (abc123prefix...)""fetched temporary token (OK)"

CompanionManager.swift

  • "received transcript: <user's words>""received transcript (N chars)"
  • Element coordinate + label logs → content-free status messages
  • Onboarding demo label + spoken text log → "pointing at element"

ElementLocationDetector.swift

  • Coordinate mapping log (raw + scaled pixel values) → single comment explaining the omission
  • Raw coordinate log → comment explaining the omission

What was NOT changed

All low-severity logs (lifecycle events, error descriptions, payload sizes, provider names) are unchanged — they contain no user data and are useful for debugging.

Testing

  • Build and run: Console.app should show no transcript text, no token values, no element labels or coordinates in Clicky output
  • Push-to-talk still works normally (logging is additive-only change)

Closes #44

Seven print statements were logging PII and security-sensitive values:
- User speech transcripts verbatim (CompanionManager.swift)
- AssemblyAI bearer token prefix (AssemblyAIStreamingTranscriptionProvider.swift)
- Screen element labels and pixel coordinates (CompanionManager.swift x3, ElementLocationDetector.swift x2)

Fixes:
- Token log → "fetched temporary token (OK)" (no token content)
- Transcript log → char count only (no speech content)
- Element/coordinate logs → replaced with content-free status messages

Low-severity logs (lifecycle events, error descriptions, payload sizes) are unchanged.

Fixes farzaa#44

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@qodo-ai-reviewer
Copy link
Copy Markdown

Hi, Although debug prints were sanitized, the PR still routes sensitive values (full transcript, full AI response, UI element labels) into analytics capture calls, which remains a high-risk data exfiltration path. This contradicts the stated goal of removing PII/security-sensitive runtime data from outputs.

Severity: remediation recommended | Category: security

How to fix: Stop sending raw PII to analytics

Agent prompt to fix - you can give this to your LLM of choice:

Issue description

Raw user transcripts, AI responses, and UI element labels are being captured in analytics event properties.

Issue Context

Even with print() redactions, analytics capture is an outbound channel and can store/share sensitive data long-term.

Fix Focus Areas

  • leanring-buddy/CompanionManager.swift[519-526]
  • leanring-buddy/CompanionManager.swift[677-701]
  • leanring-buddy/ClickyAnalytics.swift[82-104]

What to change

  • Remove transcript, response, and element_label from analytics properties.
  • Keep only non-sensitive aggregates like character_count, boolean flags (e.g., had_point_coordinate), or coarse buckets.
  • If you need debugging correlation, consider generating a per-session random ID and logging/sending that instead of content.
  • Ensure callers continue to compile after signature changes (e.g., trackUserMessageSent(characterCount:)).

Found by Qodo code review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Critical Security Issues

2 participants